Vue.component('FormItem', {
    name:'FormItem',
    template: `
<el-form :inline="inline" :label-width="width" :rule="rule">
    <el-form-item :label="item.label" v-for="(item,index) in data" :key="index">
    
        <el-input :placeholder="item.placeholder" v-model="item.value" v-if="item.type == 'text'"></el-input>
        
        <el-date-picker v-model="item.value" :default-value="item.default-value" value-format="yyyy-MM-dd" format="yyyy-MM-dd" type="date" placeholder="item.placeholder? item.placeholder :'选择日期'" v-if="item.type == 'date'"></el-date-picker>
    
        <el-switch v-model="item.value" active-color="#13ce66" inactive-color="#eeeeee" v-if="item.type == 'switch'" :active-value="1" :inactive-value="0"> </el-switch>
        
        <ht-editor v-model="item.value" v-if="item.type == 'editor'"></ht-editor>
        
        
    </el-form-item>
</el-form>
    `,
    props: {
        width:{
            type:String,
            default:''
        },
        inline:{
            type:Boolean,
            default:false, // text select switch date datetime upload textarea editor
        },
        data:{ // 数据源
            type:Array,
            default:[]
        },
        rule:{ // 绑定值
            type:Array,
            default:[]
        },
    },
    data() {
        return {

        }
    },
    created() {
        let vs = this;
        if (!vs.placeholder) vs.placeholder = vs.label

    },
    methods: {

    },
    watch: {
        isshow(v) {
            this.dialogTableVisible = v
        },
    }
})